import Subjcet from "./Subject";

/*
 * @ModuleName:
 * @Author: zhuzhaofeng
 * @Date: 2020-05-09 11:35:28
 */
class ObServer {
  name: string;
  subject: Subjcet;
  constructor(name: string, subject: Subjcet) {
    this.name = name;
    this.subject = subject;
    this.subject.attach(this)
  }
  update(): void {
    // 触发更新方法
    console.log(`${this.name} update(), state: ${this.subject.getState()}`);
  }
}
export default ObServer;
